# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=rebind
pkgver=0.3.4
pkgrel=8
groups=('blackarch' 'blackarch-exploitation')
pkgdesc='DNS Rebinding Tool.'
arch=('x86_64' 'aarch64')
url='http://code.google.com/p/rebind/'
license=('MIT')
depends=('python2' 'sqlite3' 'readline')
makedepends=('subversion')
source=("https://rebind.googlecode.com/files/${pkgname}_${pkgver//./-}.tar.gz")
sha512sums=('e6e97cc05cd313255ee1f3f2b742ea2401843144')

prepare(){
  cd "$pkgname/dev"

  sed -i 's/env python/env python2/' *.py

  chmod +x *.py
}

build(){
  cd "$pkgname/src"

  make
}

package(){
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"
  install -dm 755 "$pkgdir/usr/share/doc/$pkgname"

  rm -rf bin/rebind_{i686,x86-64}

  cp -a --no-preserve=ownership src/www "$pkgdir/usr/share/doc/$pkgname/"
  cp -a --no-preserve=ownership docs/* "$pkgdir/usr/share/doc/$pkgname/"

  # Renamed to fix conflict with community/elfkickers.
  install -m 755 src/rebind "$pkgdir/usr/bin/rebind_dns"
}

